﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UMLTouch.Core.Entities;

using UMLTouch.DomainRecognition.SegmentationAlgorithms;

namespace UMLTouch.DomainRecognition.Engines
{
    public class SegmentationEngine : AbstractEngine<Stroke,SegmentedStroke>
    {       

        public ISegmentationAlgorithm SegmentationAlgorithm { get; set; }

        List<Segment> _segments;        


        

        public override void SpecificRecognition(Stroke s)
        {
            using(SegmentationAlgorithm)
            {                
                //_segments.AddRange(SegmentationAlgorithm.SegmentStroke(s).Segments);
                //foreach (var item in _segments)
                //{
                //    PushOutput(item);
                //}
                PushOutput(SegmentationAlgorithm.SegmentStroke(s));
            }
            _segments.Clear();
            
        }



        public SegmentationEngine(ISegmentationAlgorithm segmentationAlgorithm)
        {
            SegmentationAlgorithm = segmentationAlgorithm;
            _segments = new List<Segment>();           
        }
        public SegmentationEngine()
            : this(new PersonnalAlgorithm())
        {
            
        }



    }

}
